package com.zhijiaoyun.dao;

import com.zhijiaoyun.dao.core.IBaseDao;
import com.zhijiaoyun.model.Order;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author shisfish
 * @date 2017/6/6
 */
public interface IOrderDao extends IBaseDao<Order> {

    /**
     * get by order_num
     *
     * @param orderNum
     * @return
     */
    Order selectByOrderNum(String orderNum);

    /**
     * count by params
     *
     * @param userId
     * @param status
     * @return
     */
    int countByParams(@Param("userId") long userId, @Param("status") int status);

    /**
     * page by params
     *
     * @param beginIndex
     * @param pageSize
     * @param userId
     * @param status
     * @return
     */
    List<Order> pageByParams(@Param("beginIndex") int beginIndex, @Param("pageSize") int pageSize,
                             @Param("userId") long userId, @Param("status") int status);

    /**
     * get by goodsId、goodsType and userId
     *
     * @param goodsId
     * @param goodsType
     * @param userId
     * @return
     */
    Order selectOrderByGoodsId(@Param("goodsId") Long goodsId, @Param("goodsType") int goodsType,
                               @Param("userId") long userId);
}